// pages/function/video/index/index.js


Page({

  /**
   * 页面的初始数据
   */
  data: {
    course: [],
   activeName:'1',
   id:''

  },
   onChange(event) {
      this.setData({
        activeName: event.detail,
      })},
      

 info(event) {
   console.log(event);
   wx.setStorage({
    data: event.currentTarget.dataset.id,
    key: 'chapterid_key',
  })
  wx.setStorage({
    data: event.currentTarget.dataset.videoid,
    key: 'videoid_key',
  })
    wx.navigateTo({
      url: './../info/info?src=' + encodeURIComponent(event.currentTarget.dataset.message)
    })

   },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
    const id=decodeURIComponent(options.id)
  this.setData({
    id:id
  })
  wx.setStorage({
    data: id,
    key: 'courseid_key',
  })
  var that=this
  wx.request({
    url: 'http://127.0.0.1:8110/api/edu/course/get/'+id,
    // header: {
    //   "Authorization": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjhjZjNhNzI3LTdjYzUtNGJjZi1iMDIwLTQzMWE0NmIzN2YyMCJ9.7IAWg0OU4kvkLriCkc0-wDgD218YaU7AUd_wEJCk6QHuRt78f5Ea5WvBuLbcznbF2P5Z_Z9T7K28sFEH1y0Ljg"
    // },
    type: "json",
    success: function (res) {
      that.setData({
        course: res.data.data.chapterVoList
      })
      // console.log(res.data.data.chapterVoList);
      
    }
  })
    // wx.navigateTo({
    //   url: '../classroom/classroom?id=' + encodeURIComponent(event.currentTarget.dataset.message)
    // })


  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {


  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})